package org.cevahir.alumni.model;

// Generated 29-Jun-2008 12:22:55 by Hibernate Tools 3.2.2.GA

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;

/**
 * User generated by hbm2java
 */
@Entity
@Table(name = "user", catalog = "alumni", uniqueConstraints = {
		@UniqueConstraint(columnNames = "metu_number"),
		@UniqueConstraint(columnNames = "username") })
public class User extends Model implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2947575028421307139L;
	private int id;
	private City city;
	private Job job;
	private String username;
	private String name;
	private String surname;
	private String password;
	private int yearId;
	private long metuNumber;
	private boolean approved;
	private Date creationDate;
	private Date lastUpdateWork;
	private Date lastUpdateMail;
	private Date lastUpdateCity;
	private boolean validated;
	private Set<LoginLog> loginLogs = new HashSet<LoginLog>(0);
	private Set<Mail> mails = new HashSet<Mail>(0);

	public User() {
	}

	public User(int id, String username, String name, String surname,
			String password, int yearId, long metuNumber, boolean approved,
			Date creationDate, boolean validated) {
		this.id = id;
		this.username = username;
		this.name = name;
		this.surname = surname;
		this.password = password;
		this.yearId = yearId;
		this.metuNumber = metuNumber;
		this.approved = approved;
		this.creationDate = creationDate;
		this.validated = validated;
	}

	public User(int id, City city, Job job, String username, String name,
			String surname, String password, int yearId, long metuNumber,
			boolean approved, Date creationDate, Date lastUpdateWork,
			Date lastUpdateMail, Date lastUpdateCity, boolean validated,
			Set<LoginLog> loginLogs, Set<Mail> mails) {
		this.id = id;
		this.city = city;
		this.job = job;
		this.username = username;
		this.name = name;
		this.surname = surname;
		this.password = password;
		this.yearId = yearId;
		this.metuNumber = metuNumber;
		this.approved = approved;
		this.creationDate = creationDate;
		this.lastUpdateWork = lastUpdateWork;
		this.lastUpdateMail = lastUpdateMail;
		this.lastUpdateCity = lastUpdateCity;
		this.validated = validated;
		this.loginLogs = loginLogs;
		this.mails = mails;
	}

	@Id
	@Column(name = "id", unique = true, nullable = false)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "city_id")
	public City getCity() {
		return this.city;
	}

	public void setCity(City city) {
		this.city = city;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "job_id")
	public Job getJob() {
		return this.job;
	}

	public void setJob(Job job) {
		this.job = job;
	}

	@Column(name = "username", unique = true, nullable = false)
	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	@Column(name = "name", nullable = false)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "surname", nullable = false)
	public String getSurname() {
		return this.surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	@Column(name = "password", nullable = false, length = 32)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "year_id", nullable = false)
	public int getYearId() {
		return this.yearId;
	}

	public void setYearId(int yearId) {
		this.yearId = yearId;
	}

	@Column(name = "metu_number", unique = true, nullable = false)
	public long getMetuNumber() {
		return this.metuNumber;
	}

	public void setMetuNumber(long metuNumber) {
		this.metuNumber = metuNumber;
	}

	@Column(name = "approved", nullable = false)
	public boolean isApproved() {
		return this.approved;
	}

	public void setApproved(boolean approved) {
		this.approved = approved;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "creation_date", nullable = false, length = 29)
	public Date getCreationDate() {
		return this.creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "last_update_work", length = 29)
	public Date getLastUpdateWork() {
		return this.lastUpdateWork;
	}

	public void setLastUpdateWork(Date lastUpdateWork) {
		this.lastUpdateWork = lastUpdateWork;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "last_update_mail", length = 29)
	public Date getLastUpdateMail() {
		return this.lastUpdateMail;
	}

	public void setLastUpdateMail(Date lastUpdateMail) {
		this.lastUpdateMail = lastUpdateMail;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "last_update_city", length = 29)
	public Date getLastUpdateCity() {
		return this.lastUpdateCity;
	}

	public void setLastUpdateCity(Date lastUpdateCity) {
		this.lastUpdateCity = lastUpdateCity;
	}

	@Column(name = "validated", nullable = false)
	public boolean isValidated() {
		return this.validated;
	}

	public void setValidated(boolean validated) {
		this.validated = validated;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public Set<LoginLog> getLoginLogs() {
		return this.loginLogs;
	}

	public void setLoginLogs(Set<LoginLog> loginLogs) {
		this.loginLogs = loginLogs;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Mail> getMails() {
		return this.mails;
	}

	public void setMails(Set<Mail> mails) {
		this.mails = mails;
	}

}
